package com.kefu.chat.smart;

import org.springframework.stereotype.Component;

import com.google.common.collect.Lists;
import com.kefu.common.trigger.Decision;
import com.kefu.common.trigger.Enumer;
import com.kefu.common.trigger.IEnumer;
import com.kefu.common.trigger.event.SmartEvent;
import com.kefu.common.trigger.model.EventModel;

@Component
public class ChatConnectEvent implements SmartEvent {

	public static final String TYPE="ChatConnect";
	public static final String NAME="在线";
	
	@Override
	public String type() {
		return TYPE;
	}

	@Override
	public EventModel getEventModel() {
		return EventModel.builder()
				.code(TYPE)
				.name(getMessage("smart.chat.trigger."+TYPE, NAME))
				.decisions(Lists.newArrayList(Decision.EQ))
				.events(Lists.newArrayList(EventType.values()))
				.build();
	}

	public static enum EventType implements IEnumer{

		Incoming{
			@Override
			public  Enumer toJson(){
					return Enumer.builder()
							.code(Incoming.name())
							.name(getMessage("smart.chat.trigger.ChatConnect."+Incoming.name(),"进线"))
							.build();
			}
		};

		@Override
		public abstract Enumer toJson();
		
	}

}
